package com.qtu.product_service.feign;

import com.qtu.product_service.feign.impl.HomeFeignFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

@Component
@FeignClient(value = "redis-service",fallback = HomeFeignFallBack.class)
public interface HomeFeign {
    /**
     * 存储缓存数据
     */
    @ResponseBody
    @RequestMapping(value = "api/redis/set")
    String set(@RequestParam("key") String key, @RequestBody Object value);

    /**
     * 存储数据
     */
    @ResponseBody
    @RequestMapping(value = "api/redis/setByTime",method= RequestMethod.GET)
    String setByTime(@RequestParam("key") String key, @RequestBody Object value, @RequestParam("time") long time);

    /**
     * 获取数据
     */
    @ResponseBody
    @RequestMapping("api/redis/get")
    Object get(@RequestParam("key") String key);

    /**
     * 根据 key,判断 value是否存在
     */
    @ResponseBody
    @RequestMapping("api/redis/exists")
    String exists(@RequestParam("key") String key);

    /**
     * 根据 key,删除店铺信息
     */
    @RequestMapping("api/redis/delete")
    String delete(@RequestParam("key") String...key);
}
